﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace App1
{
    class Board
    {
        private static Square[,] _square = new Square[10, 9];

        public static Square[,] Square
        {
            get { return Board._square; }
            set { Board._square = value; }
        }

        static Board()
        {
            for (int row = 0; row < 10; ++row)
                for (int col = 0; col < 9; ++col)
                {
                    _square[row, col] = new Square();
                    _square[row, col].Init(row, col, "", 0, 3, true);
                    _square[row, col].InitPic(row, col);
                }
        }

        public static void Init(int row, int col, string piece, int value, int side, bool state)
        {
            Square[row, col].Init(row, col, piece, value, side, state);
        }

        public static void UpdatePicCanMove()
        {
            for(int row = 0; row < 10; ++row)
                for (int col = 0; col < 9; ++col)                
                    Square[row, col].PicCanMove.Visible = false;
        }

        public static void ResetBoard()
        {
            for (int row = 0; row < 10; ++row)
                for (int col = 0; col < 9; ++col)
                {
                    //_square[row, col] = new Square();
                    _square[row, col].Init(row, col, "", 0, 0, false);
                    _square[row, col].InitPic(row, col);
                }
        }
    }
}
